<!DOCTYPE html>
<html lang="en">
<style>
    .chose {
        color: red;
    }
</style>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!--   3. 切换支付方式效果    -->
    <div id="app">
        <div>
            <button @click="activeIndex=0" :class="{'chose' :activeIndex===0}">微信支付</button>
            <div v-if="activeIndex===0">√</div>
        </div>
        <div>
            <button @click="activeIndex=1" :class="{'chose' :activeIndex===1}">支付宝支付</button>
            <div v-if="activeIndex===1">√</div>
        </div>
        <div>
            <button @click="activeIndex=2" :class="{'chose' :activeIndex===2}">花呗支付</button>
            <div v-if="activeIndex===2">√</div>
        </div>
    </div>
</body>
<script src="/vue.js"></script>
<script>
    const { createApp, ref } = Vue
    createApp({
        setup() {

            let activeIndex = ref(0)

            return {
                activeIndex
            }
        }
    }).mount("#app")
</script>

</html>